package cn.sylinx.horm.model.base;

import java.io.Serializable;

public class GenericModel extends Model {

    /**
     * 主键
     */
    private Serializable id;

    public Serializable getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        if (getId() == null)
            return 0;
        return getId().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        if (this.getClass() != obj.getClass()) {
            return false;
        }

        return this.hashCode() == obj.hashCode();
    }

}
